﻿@{
    Layout = null;
    
     List<EnterpriseFund.Model.TaxClassAllowance> taxClassAllowanceList =  ViewData["taxClassAllowanceList"]==null?new List<EnterpriseFund.Model.TaxClassAllowance>(): ViewData["taxClassAllowanceList"] as List<EnterpriseFund.Model.TaxClassAllowance>;
     int sum = taxClassAllowanceList.Count + 1;
     int sum2 = taxClassAllowanceList.Count + 2;
     System.Data.DataTable showData = ViewData["showData"] == null ? new System.Data.DataTable() : ViewData["showData"] as System.Data.DataTable;
     }

<!DOCTYPE html>
 @Html.Partial("LoadPanelPartial")
<html>
<head>

<script>
    var pre;
    function selectArow(sObject) {
        $(sObject).attr("style", "BACKGROUND-COLOR: #e0f2ff;color:Red;");
        if (pre != null && pre != sObject) {
            $(pre).attr("style", "BACKGROUND-COLOR: white;color:black;");
        }
        pre = sObject;
    }
</script>
    <title>JSummarySheet</title>
      @if (false)
       {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
       }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <link href="@Url.Content("~/Content/jquery-ui.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/jquery-ui.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
   
    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)
 <style>
    .tableStyle
{
	width: 2126px;
	border: solid 1px black;
	 line-height:30px;
	border-collapse: collapse;
}
.tableStyle td
{
}

.tableStyle .tdClass
{
	padding: 0px;
	border: solid 1px black;
	white-space: nowrap;
}
.tableStyle th
{
	text-align: right;
	border: solid 1px black;
}

.a 
{
position:relative;
top:expression(this.offsetParent.scrollTop);
background: white; 
} 
    </style>
</head>
<body>
<div class="a">
      <table width="2126px" style="background: white; ">
    <tr>
    <td align="center">
    <h1>企业资金扶持年度预测汇总表</h1>
    </td>
    <td>
    </td>
    </tr>
    <tr>
    <td align="center">
    制表日期：@DateTime.Now.ToString("yyyy年MM月dd日")
    </td>
        <td>
    （税收金额单位为元，补贴金额单位为万元）
    </td>
    </tr>
    </table>
     
    <table class="tableStyle" style="background: white; line-height:20px ">
    <tr>
    <td rowspan='2' class="tdClass" align="center" style=" width:40px">序号</td>
    <td rowspan='2' class="tdClass" align="center" style=" width:70px">纳税编码</td>
    <td rowspan='2' class="tdClass" align="center" style=" width:371px">企业名称</td>
    <td rowspan='2' class="tdClass" align="center" style=" width:74px">资金项目</td>
    <td colspan='@sum2' class="tdClass" align="center">本年实绩</td>
    <td colspan='3' class="tdClass" align="center">增值税</td>
    @foreach (EnterpriseFund.Model.TaxClassAllowance t in taxClassAllowanceList)
    {
        string z = t.FTaxClassAllowanceName + "补贴率";

        int s = z.Length / 3;
        int In = 0;
        for (int i = 1; i <= s; i++)
        {
            z = z.Insert(i * 3 + In, "<br/>");
            In += 5;
        }

        if (!t.FTaxClassAllowanceName.Contains("增值税"))
        {

            <td rowspan='2' class="tdClass" align="center" style=" width:50px">@Html.Raw(z)</td>
            
        }
        if (t.FTaxClassAllowanceName.Contains("营改"))
        {
            <td rowspan='2' class="tdClass" align="center"  style=" width:50px">@Html.Raw(z)</td>
        }
    }
    <td colspan='@sum' class="tdClass" align="center">可补贴金额</td>
    </tr>
    <tr>
        @foreach (EnterpriseFund.Model.TaxClassAllowance t in taxClassAllowanceList)
        {
            if (t.FTaxClassAllowanceNo == "05")
            {
                string z = t.FTaxClassAllowanceName.Insert(4, "<br/>");
           <td  class="tdClass" align="center"  style=" width:100px">@Html.Raw(z)</td>
            }
            else
            {
            <td class="tdClass" align="center" style=" width:100px">@t.FTaxClassAllowanceName</td>
            }
        }
    <td class="tdClass" align="center" style=" width:100px">营改增<br />补贴</td>
    <td class="tdClass" align="center" style=" width:100px">合计</td>
    <td class="tdClass" align="center" style=" width:100px">基数</td>
    <td class="tdClass" align="center" style=" width:50px">基数内<br/>补贴率</td>
    <td class="tdClass" align="center" style=" width:50px">基数外<br/>补贴率</td>
            @foreach (EnterpriseFund.Model.TaxClassAllowance t in taxClassAllowanceList)
            {
                string z = t.FTaxClassAllowanceName;
                int s = z.Length / 3;
                int In = 0;
                for (int i = 1; i <= s; i++)
                {
                    z = z.Insert(i * 3 + In, "<br/>");
                    In += 5;
                }
            <td class="tdClass" align="center" style=" width:70px">@Html.Raw(z)</td>
            }
        <td class="tdClass" align="center" style=" width:70px">小计</td>

                  
    </tr>
    </table>
    </div>
        <table class="tableStyle">
    @for (int i = 0; i < showData.Rows.Count; i++)
    {
        <tr onclick="selectArow(this)">
        @foreach (System.Data.DataColumn dc in showData.Columns)
        {
            string w = "";

            if (dc.ColumnName.Contains("l"))
            {
                w = "50px";
            }
            if (dc.ColumnName.Contains("e"))
            {
                w = "100px";
            }

            if (dc.ColumnName.Contains("base"))
            {
                w = "100px";
            }
            if (dc.ColumnName.Contains("FInnerRate"))
            {
                w = "50px";
            }
            if (dc.ColumnName.Contains("FOuterRate"))
            {
                w = "50px";
            }
            if (dc.ColumnName.Contains("k"))
            {
                w = "70px";
            }
            if (dc.ColumnName.Contains("ygzhj"))
            {
                w = "100px";
            }
            switch (dc.ColumnName)
            {
                case "xh":
                    w = "40px";
                    break;
                case "nsrbm":
                    w = "70px";
                    break;
                case "NSRMC":
                    w = "371px";
                    break;
                case "FFinancePropName":
                    w = "74px";
                    break;
            }
            decimal d = 0;
            if (decimal.TryParse(showData.Rows[i][dc.ColumnName].ToString(), out d))
            {
                if (d == 0)
                {
                      <td class="tdClass" align="right" style="width:@w"></td> 
                }
                else
                {
                    if (dc.ColumnName == "xh")
                    {
                         <td class="tdClass" align="center"  style="width:@w">@showData.Rows[i][dc.ColumnName]</td> 
                    }
                    else
                    {
                  <td class="tdClass" align="right"  style="width:@w">@showData.Rows[i][dc.ColumnName] &nbsp;</td> 
                    }
                }
            }
            else
            {
                if (dc.ColumnName == "NSRMC")
                {
                    <td class="tdClass" align="left"  style="width:@w">&nbsp;&nbsp; @showData.Rows[i][dc.ColumnName]</td> 
                }
                else
                {
                      <td class="tdClass" align="center"  style="width:@w">@showData.Rows[i][dc.ColumnName]</td> 
                }
            }
        }
        </tr> 
    }
    </table>
 
</body>
</html>
